const {
  BrowserWindow
} = require('electron')

window.addEventListener('DOMContentLoaded', () => {
  const replaceText = (selector, text) => {
    const element = document.getElementById(selector)
    if (element) element.innerText = text
  }

  for (const type of ['chrome', 'node', 'electron']) {
    replaceText(`${type}-version`, process.versions[type])
  }

  const element = document.getElementById("NewPage")
  const ipc = require('electron').ipcRenderer
  if (element)
    element.addEventListener("click", () => {
      console.log('click::')
      element.innerText += "|"
      // 通过事件通知主进程显示新窗体
      ipc.send('newWin')
    })
})